<section id="contest">

  <div class="tabexcursions">
    <h3><%=t('contest.ex_part')%></h3>

    <div class="filter">

    <%=t('contest.filter')%>
      <select id="tags_selector" name="tags">
        <option value="All"> <%=t('contest.All')%> </option>
        <option value="Maths"> <%=t('contest.Maths')%> </option>
        <option value="Physics"> <%=t('contest.Physics')%> </option>
        <option value="Chemistry"> <%=t('contest.Chemistry')%> </option>
        <option value="Biology"> <%=t('contest.Biology')%> </option>
        <option value="Geography"> <%=t('contest.Geography')%> </option>
        <option value="EnvironmentalStudies"> <%=t('contest.EnvironmentalStudies')%> </option>
        <option value="Engineering"> <%=t('contest.Engineering')%> </option>
        <option value="Humanities"> <%=t('contest.Humanities')%> </option>
        <option value="NaturalScience"> <%=t('contest.NaturalScience')%> </option>
        <option value="ComputerScience"> <%=t('contest.ComputerScience')%></option>
      </select>
    </div>
  </div>
  <div class="entities contest_excursions">
    <ul class="items">
      <% entities_tagged_with(["Excursion"],"ViSHCompetition2013").each do |excursion| %>
        <div class="contest_excursion_tags" style="display:none !important">
          <% excursion.tags.each do |tag| %>
            <p class="contest_excursion_tag"><%=tag.name.downcase%></p>
          <% end %>
        </div>
        <%= render :partial => 'entities/entity', :locals => { :entity => excursion, :prefix_id => "contest" } %>
      <% end %>
    </ul>
  </div>

</section>

<%content_for :javascript do%>
    $("#tags_selector").change(function() {
      if(this.value=="All"){
        $(".excursion-item").show();
      } else {
        $(".excursion-item").hide();
        $(".contest_excursion_tag:contains("+this.value.toLowerCase()+")").parents(".contest_excursion_tags").next(".excursion-item").show();
      }
    });
<% end %>